﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace lcs.Web.myplandinfo
{
    public partial class Modify : Page
    {       

        		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
				{
					int mpid=(Convert.ToInt32(Request.Params["id"]));
					ShowInfo(mpid);
				}
			}
		}
			
	private void ShowInfo(int mpid)
	{
		lcs.BLL.myplandinfo bll=new lcs.BLL.myplandinfo();
		lcs.Model.myplandinfo model=bll.GetModel(mpid);
		this.lblmpid.Text=model.mpid.ToString();
		this.txtmpname.Text=model.mpname;
		
	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtmpname.Text.Trim().Length==0)
			{
				strErr+="计划名不能为空！\\n";	
			}
			

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int mpid=int.Parse(this.lblmpid.Text);
			string mpname=this.txtmpname.Text;
			


			lcs.Model.myplandinfo model=new lcs.Model.myplandinfo();
			model.mpid=mpid;
			model.mpname=mpname;
			
			lcs.BLL.myplandinfo bll=new lcs.BLL.myplandinfo();
			bll.Update(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
